<%@ page language="java" import="java.util.*,com.model.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html> 
<head> 
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> 
<style type="text/css"> 
  html { height: 100% } 
  body { height: 100%; margin: 0px; padding: 0px } 
  #map_canvas { height: 100% } 
</style> 

<%
  ArrayList<Beanuser> al=new ArrayList<Beanuser>();
  locationBO lbo=new locationBO();
  al=lbo.getUserInfo();
 // System.out.println(al.size());
  
 %>
 
<script type="text/javascript" 
    src="http://maps.google.com/maps/api/js?sensor=true"> 
</script> 
<script type="text/javascript"> 
	var map=null; 
	var gmarkers = []; 

    //初始化地图
    function initialize() { 
    	var latlng = new google.maps.LatLng(31.27974665,120.72396718); 
    	var myOptions = { 
        zoom: 6, 
        center: latlng, 
        mapTypeId: google.maps.MapTypeId.ROADMAP 
    }; 
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); 
    var myLatLng = new google.maps.LatLng(31.27974665,120.72396718);
    google.maps.event.addListener(map, 'click', function() {
    infowindow.close();
    });
  	/* var beachMarker = new google.maps.Marker({
			                         position: myLatLng, 
			                         map: map
			                        });*/
  } 
 

function show()
{
 var objTable= document.getElementById("tb1");
 var row=objTable.rows[1];
 var n=objTable.rows.length;
// alert(n);
 for(var j=1;j<n;j++)
 {
 	var k=0;
    var message=objTable.rows[j].cells[k++].innerText;
   	var b=objTable.rows[j].cells[k++].innerText;
   	var a=objTable.rows[j].cells[k].innerText;
   //	alert(a);
    var latlng = new google.maps.LatLng(b,a);
 	var contentString = message;
    var marker = new google.maps.Marker({
			                         position:latlng,
			                         map:map,
			                         title:message 
			                        });
	//alert(message);
	 //设置infowindow窗口大小
	 var infowindow = new google.maps.InfoWindow(
  { 
    size: new google.maps.Size(150,50)
  });
 
	google.maps.event.addListener(marker, 'click', function() {
	//	alert(message);
		 marker.bindInfoWindowHtml(message);
        infowindow.setContent(message);
        infowindow.open(map,marker);
        });
    gmarkers.push(marker);	
 
}		
 	                        
 
}
//marker单击事件
function myclick(i) {
  google.maps.event.trigger(gmarkers[i], "click");
}
</script> 
<style>
 table{font-size:14px;
      color:#000000;
      background:#fffbff;}
</style>

</head> 
<body style="margin:0px; padding:0px;" onload="initialize()"> 
 <table width="100%" height="100%" border="2" bordercolor="#CCCCCC">
  <tr>
    <td width="100%" height="100%">
    	<table width="100%" height="100%" border="1"> 
        <tr> 
        <td> 
           <div id="map_canvas" style="width: 920px; height: 550px"></div> 
        </td> 
        <td valign="top" style="width:150px; text-decoration: underline; color: #4444ff;"> 
           <div id="side_bar"></div> 
        </td> 
      </tr> 
    </table> 
    </td>
    <td width="20%" height="100%" valign="top"><br>
    <h5>学生位置整体查看</h5>
    <table width="20%" border="0">
      <tr>
        <td><table  id="tb1" border="1" width=195 align="left" >
            <tr align="center">
            <td width="10%">姓名</td>
            <td width="10%">经度</td>
            <td width="10%">纬度</td>
          </tr>
          <%
		  	for(int i= 0;i<al.size();i++)
		  	 {
		  	   Beanuser lt=(Beanuser)al.get(i);
		   %>
          <tr  align="center">
            <td><%=lt.getName() %></td>
            <td><%=lt.getLat() %></td>
            <td><%=lt.getLng() %></td>
          </tr>
          <%
	      }
	       %>
        </table></td>
        <tr>
        <td colspan="3" align="center"><input value="显示所有" type="button" onclick="show()"style="width:75" >&nbsp;</td>
      </tr>
    </table>
    
	 </td>
	
	 </tr>
</table>
</body> 
</html>
